import Vue from 'vue'
import Router from 'vue-router'

// Containers
import Full from '@/containers/Full'

// Views
import Dashboard from '@/views/Dashboard'

import login from '@/views/login/Login'
// pages
import table from '@/views/pages/table/table'
// upms
import user from '@/views/yun/user'
import role from '@/views/yun/role'
// import resource from '@/views/yun/resource'
import tresource from '@/views/yun/tresource'
import menu from '@/views/yun/menu'
import tresourcetype from '@/views/yun/tresourcetype'
// 除臭
import care from '@/views/pollute/care'
import caretype from '@/views/pollute/caretype'
// 网盘
import disk from '@/views/disk/disk.vue'
// 工作流
import deployment from '@/views/work/deployment'
import leave from '@/views/work/leave/leave.vue'

Vue.use(Router)

export default new Router({
  // mode: 'hash',
  mode: 'history',
  linkActiveClass: 'open active',
  scrollBehavior: () => ({ y: 0 }),
  routes: [
    {
      path: '/',
      redirect: '/dashboard',
      name: 'Home',
      component: Full,
      children: [
        {
          path: 'dashboard',
          name: 'Dashboard',
          component: Dashboard
        }

      ]
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/pages',
      redirect: '/table',
      name: 'table',
      component: Full,
      children: [
        {
          path: 'table',
          name: '表格',
          component: table
        }

      ]
    },
    {
      path: '/upms',
      redirect: '/user',
      name: '权限管理',
      component: Full,
      children: [
        {
          path: 'user',
          name: '用户',
          component: user
        },
        {
          path: 'role',
          name: '角色',
          component: role
        },
        {
          path: 'tresource',
          name: '资源',
          component: tresource
        },
        {
          path: 'menu',
          name: '菜单',
          component: menu
        },
        {
          path: 'tresourcetype',
          name: '资源类型',
          component: tresourcetype
        }
      ]
    },
    {
      path: '/pollute',
      component: Full,
      redirect: '/pollute/care',
      name: '除臭',
      meta: { title: '除臭', icon: 'table' },
      children: [
        {
          path: 'care',
          name: '维护',
          component: care,
          meta: { title: '维护', icon: 'table' }
        },
        {
          path: 'caretype',
          name: '维护类型',
          component: caretype,
          meta: { title: '维护类型', icon: 'tree' }
        }
      ]
    },
    {
      path: '/disk',
      component: Full,
      redirect: '/disk/page',
      name: '网盘',
      children: [
        {
          path: 'page',
          name: '上传/下载',
          component: disk
        }
      ]
    },
    {
      path: '/activity',
      component: Full,
      redirect: '/activity/deployment',
      name: '工作流',
      children: [
        {
          path: 'deployment',
          name: '部署',
          component: deployment
        },
        {
          path: 'leave',
          name: '请假',
          component: leave
        }
      ]
    }
  ]
})
